package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Describe: 战败原因enum
 * @author: zly
 * @created: 2022-01-27
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum FailReasonEnum {
   //	/**战败状态（0待审批，1同意战败、2拒绝战败 3战败激活**/
    FAIL_REASON_001("clue_fail_code_001","无效线索"),
    FAIL_REASON_002("clue_fail_code_002","选择竞品"),
    FAIL_REASON_003("clue_fail_code_003","他店购车"),
    FAIL_REASON_004("clue_fail_code_004","品牌价值"),
    FAIL_REASON_005("clue_fail_code_005","价格原因"),
    FAIL_REASON_006("clue_fail_code_006","产品原因"),
    FAIL_REASON_007("clue_fail_code_007","异地客户"),
    ;


    String code;
    String name;


    /**
     * 跟进type获
     * @param code
     * @return
     */
    public static String getDictionaries(String code){
        for (FailReasonEnum fs : FailReasonEnum.values()) {
            if(fs.getCode().equals(code)){
                return fs.getName();
            }
        }
        return null;
    }

    public static FailReasonEnum getByCode(String code) {
        return Stream.of(FailReasonEnum.values())
                .filter(enums -> enums.code.equals(code))
                .findAny().orElse(null);
    }

}
